#!/usr/bin/env python
# -*- coding: utf-8 -*-


from enum import IntEnum

all = ['SESSION_USER_ID', 'SESSION_USER_TOKEN']

SESSION_USER_ID = 'session_user_id'  # session 中保存的用户 uid key
SESSION_USER_TOKEN = 'session_user_token'  # session 中保存的用户 token
SESSION_TOKEN = 'session_token'  # session 中保存的用户 token


class UserRoles(IntEnum):
    ADMIN = 1
    CUSTOMER = 2


USER_ROLES_DESC = {
    UserRoles.ADMIN.value: u"超级管理员",
    UserRoles.CUSTOMER.value: u"普通管理员"
}


class BankCardType(IntEnum):
    BANK = 1
    ALI_PAY = 2


class VerifyRequestStatus(IntEnum):
    WATING_VERIFY = 1  # 等待
    REVIEWING = 2  # 正在审核
    VERIFIED = 3  # 通过审核
    REJECTED = 4  # 被拒绝


class IntegralHistoryType(IntEnum):
    INCREASE = 1
    DECREASE = 2


class IntegralHistoryReason(IntEnum):
    TRANSACTION_SUC = 1  # 交易成功
    USER_VERIFIED = 2  # 通过身份验证

    @property
    def describe(self):
        return REASON_DICT.get(self, '')

    @property
    def integral(self):
        return INTEGRA_DICT.get(self, 0)


REASON_DICT = {
    IntegralHistoryReason.TRANSACTION_SUC: '交易成功',
    IntegralHistoryReason.USER_VERIFIED: '通过身份验证',
}

INTEGRA_DICT = {
    IntegralHistoryReason.TRANSACTION_SUC: 10,
    IntegralHistoryReason.USER_VERIFIED: 100,
}


USER_VERIFIED_MESSAGE = u'您已经通过身份验证.'
USER_REJECTED_MESSAGE = u'由于您提交的信息有误,身份验证请求被拒绝,请修改后重新提交.如有疑问请联系客服.'
